package com.nbsaas.boot.product.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "商品规格", model = "商品规格")
@Entity
@Table(name = "bs_product_specification")
@Comment("商品规格表")
public class ProductSpecification extends AbstractEntity {

    @Comment("商品ID")
    @FormField(title = "商品ID", sortNum = "1", grid = true, required = true)
    private Long productId;

    @Comment("规格名称")
    @SearchItem(name = "name", key = "name", label = "规格名称")
    @FormField(title = "规格名称", sortNum = "2", grid = true, required = true)
    @Column(length = 100, nullable = false)
    private String name;

    @Comment("规格编码")
    @SearchItem(name = "code", key = "code", label = "规格编码")
    @FormField(title = "规格编码", sortNum = "3", grid = true)
    @Column(length = 50)
    private String code;

    @Comment("规格类型")
    @FormField(title = "规格类型", sortNum = "4", grid = true, type = InputType.select)
    @Column(length = 20)
    private String type; // TEXT-文本, IMAGE-图片, COLOR-颜色

    @Comment("规格描述")
    @FormField(title = "规格描述", sortNum = "5", grid = true)
    @Column(length = 500)
    private String description;

    @Comment("是否必填")
    @FormField(title = "是否必填", sortNum = "6", grid = true, type = InputType.select)
    private Boolean required;

    @Comment("是否多选")
    @FormField(title = "是否多选", sortNum = "7", grid = true, type = InputType.select)
    private Boolean multiple;

    @Comment("排序")
    @FormField(title = "排序", sortNum = "8", grid = true, type = InputType.el_input_number, sort = true)
    private Integer sort;

    @Comment("是否启用")
    @FormField(title = "是否启用", sortNum = "9", grid = true, type = InputType.select)
    private Boolean enabled;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "10", type = InputType.richText, col = 23)
    @Column(length = 1000)
    private String note;
} 